import 'package:flutter/material.dart';
// import '../../model/details.dart';
import 'package:provide/provide.dart';
import '../../provide/details_info_provide.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class DetailsTopArea extends StatelessWidget {
  const DetailsTopArea({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Provide<DetailsProviedInfo>(
      builder:(context,child,val){
        var  goodsInfo = Provide.value<DetailsProviedInfo>(context).goodsInfo.data.goodInfo;
        if(goodsInfo!=null){
          return Container(
            color: Colors.white,
            child: Column(
              children: <Widget>[
                _goodsImage(goodsInfo.image1),
                _goodsName(goodsInfo.goodsName),
                _goodsNum(goodsInfo.goodsSerialNumber),
              ],
            ),
          );
        }
      }
      // Container(
      
      // );
    );
  }

  // 商品详细图片
  Widget _goodsImage(String url){
    return Image.network(
      url,
      width: ScreenUtil().setWidth(740),
      
    );
  }

  // 商品名称
  Widget _goodsName(String name){
    return Container(
      width: ScreenUtil().setWidth(740),
      padding: EdgeInsets.only(left:15.0),
      child: Text(name,
      style: TextStyle(
          fontSize: ScreenUtil().setSp(30.0)
        ),
      ),
    );
  }

  // 商品编号
  Widget _goodsNum(num){
    return Container(
      width: ScreenUtil().setWidth(730),
      padding: EdgeInsets.only(left:15.0),
      margin: EdgeInsets.only(top:8.0),
      child: Text(
        num,
        style: TextStyle(
          fontSize:ScreenUtil().setSp(28),
          color: Colors.black38
          ),
      ),
    );
  }
}
